/**
 * RotateTransNode.cpp
 * Coyright (c) 2009 Xiaofeng Gu. All Rights Reserved.
 * Author : Xiaofeng Gu
 *
 * Creation Data : 2009/07/23
 */

#include "stdafx.h"
#include "RotateTransNode.h"
#include "Global.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

#define PI 3.1415926

HRESULT CRotateTransNode::OnExecute()
{
	HRESULT hr = S_OK;
	hr = __super::OnExecute();
	if (hr != S_OK)
	{
		return hr;
	}

	CSKInfo* pSKInfo = GetBlockInfo<CSKInfo>(SKINFO_INSTANCE);
	CTimeline* pTimeline = pSKInfo->GetTimeline();
	CFamily* pFamily = pTimeline->GetActiveFamily();
	CKnot* pKnot = pFamily->GetActiveChild();
	Nodes* pNodes = pKnot->GetNodes();

	CSKObjectRotateObject& oRotate = pSKInfo->GetRotateDefinition();
	CVecBall* pBall = pSKInfo->GetBall();
	pBall->ReBuildForFi(oRotate.dHorizontalAngle*SK_PI/180);
	pBall->ReBuildForSita(oRotate.dVerticalAngle*SK_PI/180);
	CSKGlobal::GetMainView()->UpdateView();

	return S_OK;
}